var e, t = require("../../../@babel/runtime/helpers/interopRequireDefault"), a = t(require("../../../@babel/runtime/regenerator")), r = require("../../../@babel/runtime/helpers/toConsumableArray"), i = require("../../../@babel/runtime/helpers/asyncToGenerator"), n = t(require("../../../utils/api")), s = getApp();

Page({
    data: {
        resourceUrl: s.globalData.resourceUrl,
        tip: "下拉刷新更多内容",
        pageNum: 1,
        pageSize: 5,
        list: [],
        more: !0
    },
    getList: function() {
        var e = this;
        return i(a.default.mark(function t() {
            var i, s, u;
            return a.default.wrap(function(t) {
                for (;;) switch (t.prev = t.next) {
                  case 0:
                    return i = wx.getStorageSync("openid"), t.prev = 1, t.next = 4, n.default.readList({
                        openid: i,
                        pageNum: e.data.pageNum,
                        pageSize: e.data.pageSize
                    });

                  case 4:
                    s = t.sent, (u = e.data.list).push.apply(u, r(s.result.list)), e.setData({
                        list: u
                    }), s.result.list.length < e.data.pageSize && e.setData({
                        more: !1,
                        tip: "没有更多了"
                    }), t.next = 14;
                    break;

                  case 11:
                    t.prev = 11, t.t0 = t.catch(1), console.log(t.t0);

                  case 14:
                  case "end":
                    return t.stop();
                }
            }, t, null, [ [ 1, 11 ] ]);
        }))();
    },
    onLoad: (e = i(a.default.mark(function e(t) {
        return a.default.wrap(function(e) {
            for (;;) switch (e.prev = e.next) {
              case 0:
                this.getList();

              case 1:
              case "end":
                return e.stop();
            }
        }, e, this);
    })), function(t) {
        return e.apply(this, arguments);
    }),
    onReachBottom: function() {
        this.data.more && (this.setData({
            pageNum: ++this.data.pageNum
        }), this.getList());
    },
    toReadDetail: function(e) {
        var t = e.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/pages/readDetail/readDetail?id=" + t
        });
    }
});